﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="seasonlist.aspx.cs" Inherits="EZCRS.HCMS.Web.manage.hotel.seasonlist" %>

<%@ Register Src="../usercontrol/titlepage.ascx" TagName="titlepage" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
 

    <script src="../../Common/jquery-1.2.6.min.js"></script>

    <script src="../../Common/flexigrid/flexigrid.js"></script>

    <link rel="stylesheet" href="../../Common/flexigrid/flexigrid.css" type="text/css"
        media="screen" />
</head>
<body>

    <script type="text/javascript" charset="utf-8">
	
		$(document).ready(function(){
		
		    $('#grid').flexigrid({
		    
		        height: 350,
		        //striped:false,		        
		        url:'?action=get',		        
		        dataType: 'json',  		        
		        colModel: [
                    {display: '<%= Resources.Site.LabName %>', name : 'name', width : 100, sortable : false, align: 'center'},   
                    {display: '<%= Resources.Site.ScriptStartDate %>', name : 'start', width : 180, sortable : false, align: 'left'},   
                    {display: '<%= Resources.Site.ScriptEndDate %>', name : 'end', width : 180, sortable : false, align: 'left'},
                    {display: '<%= Resources.Site.ScriptWeek %>', name : 'week', width : 350, sortable : false, align: 'left'} 
                ],                
                singleSelect: true,                
                buttons : [
                    { name: '<%= Resources.Site.LabNew %>', bclass:"add", onpress: doCommand},   
                    { name: '<%= Resources.Site.LabModify %>', bclass:"edit", onpress: doCommand},
                    { name: '<%= Resources.Site.ScriptDel %>', bclass:"delete", onpress: doCommand},   
                    { separator: true}
                ],                  
                showTableToggleBtn: true,
                rp: 15,
                usepager: true,
                useRp: true                
		    });
		    
		    
		});
		
		
		function doCommand(com, grid){
		
            if (com == '<%= Resources.Site.LabModify %>'){
            
                if($('.trSelected', grid)[0] == null) return;
            
                var rowid = $('.trSelected', grid)[0].id.replace(/row/,"");
                
                //alert(rowid);
                if(rowid != '')
                    window.location = 'seasonlist_add.aspx?id=' + rowid;
            }
            else if(com == '<%= Resources.Site.LabNew %>'){
                window.location = 'seasonlist_add.aspx';
            }
            else if(com == '<%= Resources.Site.ScriptDel %>'){
            
                if($('.trSelected', grid)[0] == null) return;
                
                var rowid = $('.trSelected', grid)[0].id.replace(/row/,"");
                
                if(rowid != ''){
                    if(confirm("<%= Resources.Site.ScriptConfirm %>")){
                            
                            var data = { id: rowid };
                            
                            $.post("seasonlist.aspx?action=del", data, 
                                function(data, state){
                                    doRefresh();
                                    
                            }, "json");
                    }
                }
            }
        }
        
        function doRefresh(){
            $('#grid').flexOptions().flexReload();
        }
        
    </script>

    <form id="form1" runat="server">
    <uc2:titlepage ID="Titlepage1" runat="server" inittitle="<%$ Resources:Site, TitleSeason %>">
    </uc2:titlepage>
    </form>
    <table id="grid">
    </table>
    <div id="loadinfo" align="center">
    </div>
</body>
</html>
